#include <iostream>
#include <algorithm>
#include <map>
#include <string>
#include <vector>
using namespace std;

struct studentscore{
	int online;
	int mid;
	int last;
};
struct node{
	string s;
	studentscore t;
	int sum;
};
bool cmp(node a1,node a2){
	if( a1.sum!=a2.sum ){ return a1.sum>a2.sum; }
	return a1.s<a2.s;
}

int  main(){
	int P,M,N;
	cin>>P>>M>>N;
	string s;
	studentscore score;
	map<string,studentscore> mp;
	map<string,studentscore>::iterator p;
	for( int i=0; i<P; i++ ){
		cin>>s>>score.online;
		score.mid=-1;score.last=-1;
		if( score.online>=200 ) mp.insert(make_pair(s,score));
	}
	for( int i=0; i<M;i++ ){
		int k;
		cin>>s>>k;
		if( (p=mp.find(s))!=mp.end() ) p->second.mid=k;
	}
	for( int i=0; i<N; i++ ){
		int k;
		cin>>s>>k;
		if( (p=mp.find(s))!=mp.end() ) p->second.last=k;
	}
	double sum;
	vector <node> v;
	for( p=mp.begin(); p!=mp.end(); p++ ){
		if( p->second.last==-1 ){
			sum=0;
		}else if( p->second.mid>p->second.last ){
			sum=p->second.mid*0.4+p->second.last*0.6+0.5;
		}else{
			sum=p->second.last;
		}
		if( sum>=60 ){
			node q;
			q.s=p->first;q.t=p->second;q.sum=(int)sum; 
			v.push_back(q);
		}
	}
	sort(v.begin(),v.end(),cmp);
	for( int i=0; i<v.size(); i++ ){
		printf("%s %d %d %d %d\n",v[i].s.c_str(),v[i].t.online,v[i].t.mid,v[i].t.last,v[i].sum);
	} 
	return 0;
}
